package com.iwith.dongmoon.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.TextView;

public class SignUpDocumentActivity extends Activity implements OnClickListener {
	private TextView doc1;
	private TextView doc2;
	private CheckBox checkbox1;
	private CheckBox checkbox2;
	private Button nextBt;
	private Button prevBt;
	private ImageView title;

	public final static int SIGNUPDOCUMENT_ACTIVITY = 11001;

	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.signup_document);
	}

	@Override
	public void onResume() {
		super.onResume();
		Initialize();
	}

	private void Initialize() {
		doc1 = (TextView) findViewById(R.id.signup_document_doc1);
		doc2 = (TextView) findViewById(R.id.signup_document_doc2);
		checkbox1 = (CheckBox) findViewById(R.id.signup_document_check1);
		checkbox2 = (CheckBox) findViewById(R.id.signup_document_check2);
		nextBt = (Button) findViewById(R.id.signup_document_nextbt);
		prevBt = (Button) findViewById(R.id.backbtn);
		title = (ImageView) findViewById(R.id.title);

		nextBt.setOnClickListener(this);
		prevBt.setOnClickListener(this);
		title.setOnClickListener(this);
	}

	public void onActivityResult(int requestCode, int resultCode, Intent intent) {
		super.onActivityResult(requestCode, resultCode, intent);
		setResult(resultCode, intent);
		finish();
	}

	public void onClick(View v) {
		// TODO Auto-generated method stub
		if(v.getId()==title.getId()){
			Intent intent=new Intent(this, MainIconView.class);
			intent.putExtra("flag", true);
			startActivity(intent);
		} else if(v.getId()==nextBt.getId()){
			if (checkbox1.isChecked() == true && checkbox2.isChecked() == true) {
				Intent intent = new Intent(this, SignUpInfoActivity.class);
				startActivityForResult(intent, SIGNUPDOCUMENT_ACTIVITY);
			}
		} else if(v.getId()==prevBt.getId()){
			finish();
		}
	}
}
